package com.itheima.service.impl;

import com.itheima.bean.Classes;
import com.itheima.mapper.ClassesMapper;
import com.itheima.service.ClassesService;
import com.itheima.utils.MapperUtils;

import java.util.List;

public class ClassesServiceImpl implements ClassesService {
    @Override
    public List<Classes> findAll() {
        try{
            ClassesMapper mapper = MapperUtils.getMapper(ClassesMapper.class);
            List<Classes> classes = mapper.findAll();

            MapperUtils.commit();
            return classes;
        }catch(Exception e){
            e.printStackTrace();
            MapperUtils.rollback();
        }finally {
            MapperUtils.close();
        }
        return null;
    }
}
